<%@ page language="java"
         contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"
         import="com.shxt.hotel.background.User"
         import="java.util.Map"
%>
<%
    request.setCharacterEncoding("UTF-8");
    Map<String, String[]> paraMap = request.getParameterMap();
    
    User user = new User();
    int row = user.register(paraMap);
    user.login(paraMap.get("username")[0], paraMap.get("password")[0]);
    String location = "../index.jsp";
    
    session.setAttribute("id", user.getUserId());
    session.setAttribute("username", paraMap.get("username")[0]);
    user.close();
    
    response.sendRedirect(location);
%>